// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   change_module_ok.java

package security.user;

import include.nseer_cookie.*;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;

public class change_module_ok extends HttpServlet
{

	public change_module_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			InsMod im = new InsMod();
			nseer_db_backup1 db = new nseer_db_backup1(dbApplication);
			String human_name = request.getParameter("human_name");
			String human_ID = request.getParameter("human_ID");
			String choose_value = request.getParameter("choose_value");
			String file_id[] = request.getParameterValues("file_id");
			if (db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				db.executeUpdate((new StringBuilder("delete from ")).append(choose_value.split("/")[0]).append("_view where module_name!='all' and human_ID='").append(human_ID).append("'").toString());
				db.executeUpdate((new StringBuilder("delete from security_workspace where human_ID='")).append(human_ID).append("' and view_tree_name='").append(choose_value.split("/")[0]).append("'").toString());
				db.executeUpdate((new StringBuilder("delete from drag_img where human_ID='")).append(human_ID).append("' and tree_view_name='").append(choose_value.split("/")[0]).append("_view'").toString());
				if (file_id != null)
				{
					for (int i = 0; i < file_id.length; i++)
					{
						im.insert(choose_value.split("/")[0], human_ID, human_name, file_id[i], db);
						im.insertw(choose_value.split("/")[0], choose_value.split("/")[1], human_ID, db);
					}

				}
				db.commit();
				db.close();
				response.sendRedirect((new StringBuilder("security/user/change_module_ok_a.jsp?human_ID=")).append(human_ID).append("&&module=").append(toUtf8String.utf8String(exchange.toURL(choose_value.split("/")[1]))).append("&&human_name=").append(toUtf8String.utf8String(exchange.toURL(human_name))).toString());
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
